package com.huangsm.cloud.microservicerabbitmq.consumer;

import com.huangsm.cloud.microservicerabbitmq.service.AmqpService;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author huang
 * @PACKAGE_NAME com.huangsm.cloud.microservicerabbitmq.consumer
 * @PROJECT_NAME microservice-springcloud
 * @date 2019/1/17
 */
@Component
@Slf4j
@NoArgsConstructor
public class AmqpServiceConsumer {

    @Autowired
    private AmqpService amqpService;

    @RabbitListener(queues = {"com.queue.notify.hello"})
    public void receiveSmsCodeQueue(String message) {
        log.info("------hello：消费者处理消息------");
        log.debug(message);
        this.amqpService.convertAndSend(message);
    }
}
